<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$admin_title}</title>
<include file="./core/Modules/Center/Tpl/Public/js_css_header.html" />
<script type="text/javascript">
var templateList = new Array(<foreach name="templateList" item="temp" key="i"><if condition="$i neq 0">,</if>"{$temp}"</foreach>);

function catalogClickShow(divIdBlock){
	$("[name='extraBlock']").hide();
	if(divIdBlock != ''){
		var divIdArr = divIdBlock.split(",");
		for(var i=0;i<divIdArr.length;i++){
			$("#"+divIdArr[i]).show();
		}
	}
}
function catatypeClick(type){
	if(type == "sys"){
		$("#sys").show();
		$("#link").hide();
	}else{
		$("#link").show();
		$("#sys").hide();
	}
}
//显示指定类型的模版[列表模版]
function showListTemps(type){
	$("[name='list_module_filepath'] option").remove();
	for (var i=0;i<templateList.length;i++){
		if(templateList[i].indexOf(type) > -1 || type == ''){
			$("[name='list_module_filepath']").append("<option value='"+templateList[i]+"'>"+templateList[i]+"</option>");
		}
	}
}
//显示指定类型的模版[内容模版]
function showViewTemps(type){
	$("[name='view_module_filepath'] option").remove();
	for (var i=0;i<templateList.length;i++){
		if(templateList[i].indexOf(type) > -1 || type == ''){
			$("[name='view_module_filepath']").append("<option value='"+templateList[i]+"'>"+templateList[i]+"</option>");
		}
	}
}
$(function(){
	<if condition="$obj.catalog_type eq CatalogType::$SINGEL_ARTICLE">
		var viewtype = "singel_article_view";
	<elseif condition="$obj.catalog_type eq CatalogType::$DYNAMIC_MODULE"/>
		<foreach name="dynamicModuleList" item="dm">
			<php>if($dm['dynamic_module_id'] == $obj['dynamic_module_id']){</php>
				var viewtype = "{$dm.table_name}_view";
				showListTemps('{$dm.table_name}_list');
			<php>}</php>
		</foreach>
	<elseif condition="$obj.catalog_type eq CatalogType::$GUESTBOOK"/>
		var viewtype = "guestbook";
	<elseif condition="$obj.catalog_type eq CatalogType::$FM_PAGE"/>
		var viewtype = "";
	<elseif condition="$obj.catalog_type eq CatalogType::$RESERVE_MODULE"/>
		var viewtype = "bd";
	<else/>
		var viewtype = "singel_article_view";
	</if>
	showViewTemps(viewtype);
});

</script>
</head>
<body>
	<include file="./core/Modules/Center/Tpl/Public/header.html" />
	<table width="100%" height="100%" class="manage_block">
	  <tbody>
	    <tr>
	      <td class="manage_left" valign="top">
	      	<include file="./core/Modules/Center/Tpl/Public/system_manage_left.html" />
	      </td>
	      <td valign="top">
	        <div class="cont_wrap">
				<div class="position">当前位置:&nbsp;<a href="__APP__/center/frame/index/">首页</a>&nbsp;&gt;&nbsp;<a href="javascritp:;" target="_self">栏目导航设置</a>&nbsp;&gt;&nbsp;<if condition="$obj != null">修改操作<else />新增操作</if></div>
				<form name="formSubmit" action="__APP__/center/catalog/<if condition="$obj != null">update/<else />add/</if>" method="post" enctype="multipart/form-data">
					<if condition="$obj != null"><input type="hidden" name="id" value="{$obj.catalog_id}" /></if>
					<table width="100%" cellpadding="0" cellspacing="0" class="line">
						<tr height="20">
							<td align="center" width="18%" style="border-bottom: 0px;" class="tabl_line_bg">栏目类型</td>
							<td align="left" style="border-bottom: 0px;">
								<input type="radio" value="0" onclick="catatypeClick('sys');" name="is_external_link" <if condition='$obj.catalog_type neq CatalogType::$REDIRECT'>checked="checked"</if> />&nbsp;系统内链&nbsp;&nbsp;
								<input type="radio" value="1" onclick="catatypeClick('link');" name="is_external_link" <if condition='$obj.catalog_type eq CatalogType::$REDIRECT'>checked="checked"</if>/>&nbsp;系统外链
							</td>
						</tr>
					</table>
					<!-- 系统内连 开始 -->
					<table id="sys" width="100%" border="0" cellpadding="0" cellspacing="0" class="line" <if condition='$obj.catalog_type eq CatalogType::$REDIRECT'>style="display:none;"</if>>
						<tr height="20">
							<td align="center" width="18%" class="tabl_line_bg">栏目标题</td>
							<td align="left">
								<input type="text" name="catalog_name" size="80" value="{$obj.catalog_name}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">英文名（选填）</td>
							<td align="left">
								<input type="text" name="catalog_eng_name" size="80" value="{$obj.catalog_eng_name}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">上级分类</td>
							<td align="left">
								<select name="pid" class="select">
			                      <option value="0" <php>if(empty($obj) || $obj['pid'] == 0){echo 'selected="selected"';}</php>>顶级分类</option>
			                      <foreach name="catalogList" item="a">
			                      <option value="{$a.catalog_id}" <php>if($a['catalog_id'] == $obj["pid"]){echo 'selected="selected"';}</php>>{$a.catalog_name}</option>
			                      <php>echo CatalogHelper::getCatalogSelectTree($a["catalog_id"],$subCatalogList,$obj["pid"]);</php>
			                      </foreach>
			                    </select>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">上传图片</td>
							<td align="left">
								<input type="text" id="picture_text" name="picture_text" size="80" value="{$obj.picture_addr}" class="text" style="width: 220px" readonly/>
								<input id="picture" name="picture" type="file" /><span id="picture_progress"></span>
								<script type="text/javascript">
									$(function() {
										<php>$timestamp = time();</php>
										uploadify4j("#picture",'*.gif;*.jpg;*.jpeg;*.png','{$timestamp}','<php>echo md5('unique_salt' . $timestamp);</php>');
									});
								</script>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">URL路径</td>
							<td align="left">
								<input type="text" name="catalog_url_name" size="80" value="{$obj.catalog_url_name}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">SEO标题</td>
							<td align="left">
								<input type="text" name="seo_title" size="80" value="{$obj.seo_title}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">SEO关键字</td>
							<td align="left">
								<input type="text" name="seo_keywords" size="80" value="{$obj.seo_keywords}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">SEO描述</td>
							<td align="left">
								<input type="text" name="seo_description" size="80" value="{$obj.seo_description}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">导航栏展示方式</td>
							<td align="left">
								<input type="radio" name="is_hidden" value="0" <if condition="empty($obj) OR ($obj.is_hidden eq 0)">checked="checked"</if>/>&nbsp;显示&nbsp;
								<input type="radio" name="is_hidden" value="1" <if condition="$obj.is_hidden eq 1">checked="checked"</if>/>&nbsp;隐藏&nbsp;
							</td>
						</tr>
						<tr id="cata_type" height="20">
							<td align="center" class="tabl_line_bg">类型</td>
							<td align="left">
								<input type="radio" name="catalog_type" value="单篇模块" onclick="catalogClickShow('');showViewTemps('singel_article_view');" <if condition="empty($obj) || $obj.catalog_type eq CatalogType::$SINGEL_ARTICLE">checked="checked"</if>/>&nbsp;单篇模块&nbsp;
								<foreach name="dynamicModuleList" item="dm">
								<input type="radio" name="catalog_type" value="dynamic:{$dm.dynamic_module_id}" onclick="catalogClickShow('page_show_num,list_module_addr');showListTemps('{$dm.table_name}_list');showViewTemps('{$dm.table_name}_view');" <php>if($dm['dynamic_module_id'] == $obj['dynamic_module_id']){echo 'checked="checked"';}</php>/>&nbsp;{$dm.module_name}&nbsp;
								</foreach>
								<input type="radio" name="catalog_type" value="表单模块" onclick="catalogClickShow('reserve_module_id');showViewTemps('bd');" <if condition="$obj.catalog_type eq CatalogType::$RESERVE_MODULE">checked="checked"</if>/>&nbsp;表单模块&nbsp;
								<input type="radio" name="catalog_type" value="封面模块" onclick="catalogClickShow('');showViewTemps('');" <if condition="$obj.catalog_type eq CatalogType::$FM_PAGE">checked="checked"</if>/>&nbsp;封面模块&nbsp;
								<input type="radio" name="catalog_type" value="留言模块" onclick="catalogClickShow('');showViewTemps('guestbook');" <if condition="$obj.catalog_type eq CatalogType::$GUESTBOOK">checked="checked"</if>/>&nbsp;留言模块&nbsp;
							</td>
						</tr>
						<tr id="reserve_module_id" name="extraBlock" height="20" style="<if condition='$obj.catalog_type neq CatalogType::$RESERVE_MODULE'>display: none;</if>">
							<td align="center" class="tabl_line_bg">表单模型</td>
							<td align="left">
								<select name="reserve_module_id" class="select">
			                      <foreach name="reserveModuleList" item="reserveM">
			                      <option value="{$reserveM.reserve_module_id}" <php>if($reserveM["reserve_module_id"] == $obj["dynamic_module_id"]){echo 'selected="selected"';}</php>>{$reserveM.module_name} [{$reserveM.table_name}]</option>
			                      </foreach>
			                    </select>
							</td>
						</tr>
						<tr id="list_module_addr" name="extraBlock" height="20" style="<if condition='$obj.catalog_type neq CatalogType::$DYNAMIC_MODULE'>display: none;</if>">
							<td align="center" class="tabl_line_bg">列表模版</td>
							<td align="left">
								<select name="list_module_filepath" class="select">
			                      <foreach name="templateList" item="temp">
			                      <option value="{$temp}" <php>if($temp == $obj["list_module_filepath"]){echo 'selected="selected"';}</php>>{$temp}</option>
			                      </foreach>
			                    </select>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">内容模版</td>
							<td align="left">
								<select name="view_module_filepath" class="select">
			                      <foreach name="templateList" item="temp">
			                      <option value="{$temp}" <php>if($temp == $obj["view_module_filepath"]){echo 'selected="selected"';}</php>>{$temp}</option>
			                      </foreach>
			                    </select>
							</td>
						</tr>
						<tr id="page_show_num" name="extraBlock" height="20" style="<if condition='empty($obj) || $obj.catalog_type neq CatalogType::$DYNAMIC_MODULE'>display: none;</if>">
							<td align="center" class="tabl_line_bg">列表页：一页显示多少条数据</td>
							<td align="left">
								<input type="text" name="page_show_num" size="80" value="<if condition='$obj eq null'>20<else/>{$obj.page_show_num}</if>" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="left" colspan="2">
								<if condition="$referUrl != '' && $referUrl != null"><a class="button" href="javascript:redirectURL('{$referUrl}');">返回</a></if>
								&nbsp;<a id="submit_btn" class="button" href="javascript:;" onclick="doSubmitForm(this,'__APP__')">提交</a>
							</td>
						</tr>
					</table>
					<!-- 系统内连 结束 -->
					<!-- 系统外链 开始 -->
					<table id="link" width="100%" border="0" cellpadding="0" cellspacing="0" class="line" <if condition='$obj.catalog_type neq CatalogType::$REDIRECT'>style="display:none;"</if>>
						<tr height="20">
							<td align="center" width="18%" class="tabl_line_bg">栏目标题</td>
							<td align="left">
								<input type="text" name="catalog_name2" size="80" value="{$obj.catalog_name}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">英文名（选填）</td>
							<td align="left">
								<input type="text" name="catalog_eng_name2" size="80" value="{$obj.catalog_eng_name}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">上级分类</td>
							<td align="left">
								<select name="pid2" class="select">
			                      <option value="0" <php>if(empty($obj) || $obj['pid'] == 0){echo 'selected="selected"';}</php>>顶级分类</option>
			                      <foreach name="catalogList" item="a">
			                      <option value="{$a.catalog_id}" <php>if($a['catalog_id'] == $obj["pid"]){echo 'selected="selected"';}</php>>{$a.catalog_name}</option>
			                      <php>echo CatalogHelper::getCatalogSelectTree($a["catalog_id"],$subCatalogList,$obj["pid"]);</php>
			                      </foreach>
			                    </select>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">上传图片</td>
							<td align="left">
								<input type="text" id="picture2_text" name="picture2_text" size="80" value="{$obj.picture_addr}" class="text" style="width: 220px" readonly/>
								<input id="picture2" name="picture2" type="file" /><span id="picture2_progress"></span>
								<script type="text/javascript">
									$(function() {
										<php>$timestamp = time();</php>
										uploadify4j("#picture2",'*.gif;*.jpg;*.jpeg;*.png','{$timestamp}','<php>echo md5('unique_salt' . $timestamp);</php>');
									});
								</script>
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">导航栏展示方式</td>
							<td align="left">
								<input type="radio" name="is_hidden2" value="0" <if condition="empty($obj) OR ($obj.is_hidden eq 0)">checked="checked"</if>/>&nbsp;显示&nbsp;
								<input type="radio" name="is_hidden2" value="1" <if condition="$obj.is_hidden eq 1">checked="checked"</if>/>&nbsp;隐藏&nbsp;
							</td>
						</tr>
						<tr height="20">
							<td align="center" class="tabl_line_bg">跳转网址</td>
							<td align="left">
								<input type="text" name="redirect_url" size="80" value="{$obj.redirect_url|default='http://'}" class="text"/>
							</td>
						</tr>
						<tr height="20">
							<td align="left" colspan="2">
								<if condition="$referUrl != '' && $referUrl != null"><a class="button" href="javascript:redirectURL('{$referUrl}');">返回</a></if>
								&nbsp;<a id="submit_btn" class="button" href="javascript:;" onclick="doSubmitForm(this,'__APP__')">提交</a>
							</td>
						</tr>
					</table>
					<!-- 系统外链 结束 -->
				</form>
			</div>
	      </td>
	    </tr>
	  </tbody>
	</table>
</body>
</html>
